import java.util.Arrays;

public class 插入排序 {
    public static void main(String args[]){
        int a[] = new int[]{1,5,9,3,2,4,5,8,6,3,10,56,12,122,43,84};
        for(int i=1;i<a.length;i++){
            if(a[i]<a[i-1]){
                int j = i-1;
                int x = a[i];
                a[i]=a[i-1];
                while(x<a[j]){
                    a[j+1]=a[j];
                    j--;
                }
                a[j+1]=x;
            }
        }
        System.out.println(Arrays.toString(a));
    }
}
